$(function() {
    $('.ck').click(function(){
        var orderid=$(this).find('.order').val();
        $.post('xq',{orderid:orderid},function(date)
        {
            var date=date.msg;
            var src='';
            $.each(date,function(k,val){
                var k=k+1;
                src += '<tr class="js"><td>'+k+'</td>'+
                    '<td>'+val.g_goodsname+'('+val.formatname+')'+'</td>'+
                    '<td>'+val.price+'</td>' +
                    '</tr>';
                $('.jt').html(src);
            })
        },'json')
    });
    var index = parent.layer.getFrameIndex(window.name); //获取当前窗体索引
    $('.tj').on('click', function() {
        var orderid = $(this).find('.orderid').val();
        $.post("xg", {orderid: orderid}, function (date) {
            parent.$('.orderid').html(orderid + '<input type="hidden" id="orderid" value="' + orderid + '">');
            var data = date.msg.data;
            var src = '';
            var pay = date.msg.pay;
            parent.$('.all').html(pay.all_money);
            $.each(data, function (k, val) {
                var k = k + 1;
                src += '<ul id="cd" class="am-list am-margin-bottom-xs am-avg-sm-4 am-avg-md-4 am-avg-lg-4 am-text-lg am-text-center am-padding-sm color02">' +
                    '<li>' +
                    k +
                    '</li>' +
                    '<li>' +
                    val.g_goodsname + '(' + val.formatname + ')' +
                    '</li>' +
                    '<li>1</li>' +
                    '<li class="press">&yen' +
                    val.price +
                    '<em class="am-icon-chevron-down am-padding-left"></em></li></ul>' +
                    '<div class="am-g am-padding-sm yc cs">' +
                    '<div class="am-u-sm-6 am-u-md-6 am-u-lg-6 am-padding-right-0">' +
                    '<a href="#" class="am-btn am-btn-danger del am-radius">' +
                    '<input type="hidden" class="dels" value="' + val.id + '">' +
                    '<i class="am-icon-trash am-padding-right-xs">' +
                    '</i>删除' +
                    '</a>' +
                    '</div>' +
                    /*'<div class="am-u-sm-6 am-u-md-6 am-u-lg-6 am-padding-left-0">' +
                    '<div class="am-input-group">' +
                    '<span class="am-input-group-label am-icon-plus">' +
                    '</span><input type="text" class="am-form-field">' +
                    '<span class="am-input-group-label am-icon-minus">' +
                    '</span>' +
                    '</div>' +
                    '</div>' +*/
                    '</div>';
                parent.$('#cart').html(src);
            });
            parent.layer.close(index); //执行关闭
            //window.location.href = "menu?orderid="+orderid;
        });
    })
})